package com.talkyun.openx.server.core;

import java.util.LinkedHashMap;
import java.util.Map;

public class ServiceRequest extends ServiceMessage {
    private String mapping;
    private String method;
    private Map<String, Object> args;

    public ServiceRequest(String session) {
        super(session);
        args = new LinkedHashMap<String, Object>();
    }

    public ServiceRequest(String mapping, String method) {
        this(null);
        this.mapping = mapping;
        this.method = method;
    }

    public String getMapping() {
        return mapping;
    }

    public void setMapping(String mapping) {
        this.mapping = mapping;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Map<String, Object> getArgs() {
        return args;
    }

    public void setArgs(Map<String, Object> args) {
        this.args = args;
    }

    @Override
    public String toString() {
        if (args == null) {
            return mapping + ":" + method + "()";
        } else {
            return mapping + ":" + method + "(" + args + ")";
        }
    }
}